using INTEX.DataBase;
using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.Collections.Generic;
using System.Data;
namespace WPFExcelReport
{
    public partial class VMKRF
    {
        
       public void ENDRP13(Dictionary<string, object> pm)
        {

            dwData = TBMain.NewRow();
            SetUpNewRow(ref dwData);
            #region====JLT======
            dwData["MKFMANDANT"] = "00";
            dwData["MKFMLFDNR"] = (string)pm["MLFD"];
            dwData["MKFMNRKRS"] = (string)pm["MKRS"];
            dwData["MKFMPOS"] = (string)pm["MPOS"];
            dwData["MKFLFDNR"] = "1"; 
            dwData["MKFERLKZ"] ="J";
            dwData["MKFAUFKRS"] = (string)pm["KRS"];
            dwData["MKFAUFLFD"] = (string)pm["LFD"];
            dwData["MKFAUFPOS"] = (string)pm["POS"];
            dwData["MKFAFOLGE"] = (string)pm["STEP"];
            dwData["MKFERLDAT"] = (string)pm["PDCDATE"];
             #endregion 
            UMKRF02(dwData);
        }
        public void CREATERP13(Dictionary<string, object> pm)
        {
 
            dwData = TBMain.NewRow();
            SetUpNewRow(ref dwData);
            #region====JLT======
             
            dwData["MKFMANDANT"] = "00";
            dwData["MKFMLFDNR"] = (string)pm["MLFD"];
            dwData["MKFMNRKRS"] = (string)pm["MKRS"];
            dwData["MKFMPOS"]   = (string)pm["MPOS"];
            SResult = QMKRF04(dwData);
            int lfd = 1;
            foreach (DataRow row in SResult.Tables[0].Rows)
            {
                lfd = Convert.ToInt16(row["MKFLFDNR"].ToString());
                lfd = lfd + 1;
            }
            dwData["MKFLFDNR"] = lfd;
            dwData["MKFNEUB"] = (string)pm["NEWUSER"];
            dwData["MKFNEUD"] = (string)pm["PDCDATE"];
        
            dwData["MKFERLDAT"] = "00000000";
            dwData["MKFAUFKRS"] =(string)pm["KRS"];
            dwData["MKFAUFLFD"] =(string)pm["LFD"];
            dwData["MKFAUFPOS"] = (string)pm["POS"];
            dwData["MKFAFOLGE"] = (string)pm["STEP"];
            dwData["MKFTP"] = "0000";         
            dwData["MKFPLDATV"] = (string)pm["PDCDATE"];
            dwData["MKFSCHICHTV"] = "1"; 
            dwData["MKFRUESTZT"] = "0";
            dwData["MKFBEARBZT"] = "0";
            dwData["MKFSME"] = "1";
            dwData["MKFSMG1"] =100* (double)pm["PLANQTY"];
            dwData["MKFSMG2"] = "0";
            dwData["MKFSMG3"] = "0";
            dwData["MKFSMG4"] = "0";
            dwData["MKFSMG5"] = "0";
            dwData["MKFSMG6"] = "0";
            dwData["MKFSMG7"] = "0";
            dwData["MKFSMG8"] = "0";
            dwData["MKFPLSTUFE"] = "W"; 
            dwData["MKFFILLER"] = "AV20                                                                        ";
            #endregion 
            InsertMKRF(dwData);
        }
    }
}
